package com.hualude.roadsign.controller;

import com.hualude.roadsign.dto.DTRequestDto;
import com.hualude.roadsign.dto.DTResponseDto;
import com.hualude.roadsign.dto.JsonMsgDto;
import com.hualude.roadsign.service.MonitorFaultCheckService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by ding on 2017/8/7.
 */
@Controller
@RequestMapping("/rds_monitorFaultCheck")
public class MonitorFaultCheckController {
    @Resource
    private MonitorFaultCheckService monitorFaultCheckService;

    @RequestMapping(value = "/getMonitorFaultCheck4DT")
    @ResponseBody
    public DTResponseDto getMonitorFaultCheck4DT(DTRequestDto dtRequestDto, Integer actorId , Integer orgId) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = monitorFaultCheckService.getMonitorFaultCheck4DT(dtRequestDto,actorId, orgId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dtResponseDto;
    }



    @RequestMapping(value = "/monitorFaultAudit")
    @ResponseBody
    public JsonMsgDto monitorFaultAudit(Integer isPass, String feedback, Integer monitorFaultId, Integer userId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(monitorFaultCheckService.monitorFaultAudit(isPass, feedback, monitorFaultId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getMonitorFaultCheckList4App")
    @ResponseBody
    public JsonMsgDto getMonitorFaultCheckList4App(Integer orgId, String actorIds, Integer faultStatus, Integer count, Integer size) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(monitorFaultCheckService.getMonitorFaultCheckList4App(orgId, actorIds, faultStatus, count, size));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getMonitorInfo2Fault")
    @ResponseBody
    public JsonMsgDto getMonitorInfo2Fault(Integer monitorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(monitorFaultCheckService.getMonitorInfo2Fault(monitorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getMonitorFaultInfo2Fault")
    @ResponseBody
    public JsonMsgDto getMonitorFaultInfo2Fault(Integer monitorId, Integer monitorFaultId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(monitorFaultCheckService.getMonitorFaultInfo2Fault(monitorId, monitorFaultId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getMonitorFaultReportList4App")
    @ResponseBody
    public JsonMsgDto getMonitorFaultReportList4App(Integer orgId, String actorIds, Integer faultStatus, Integer count, Integer size)
            throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(monitorFaultCheckService.getMonitorFaultReportList4App(orgId,actorIds,faultStatus,count,size));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }
}
